import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Entity
@Table(name = "sales_orders")
public class SalesOrder {
    @Id
    @Column(name = "销售订单ID")
    private String orderId;
    
    @Column(name = "销售时间")
    @Temporal(TemporalType.TIMESTAMP)
    private Date time;
    
    @Column(name = "销售数量")
    private Integer quantity;
    
    @Column(name = "销售金额")
    private Float amount;
    
    @Column(name = "顾客ID")
    private String customerId;
    
    @ManyToOne
    @JoinColumn(name = "顾客ID", insertable = false, updatable = false)
    private Customer customer;
    
    @OneToMany(mappedBy = "salesOrder", cascade = CascadeType.ALL)
    private List<Sale> sales;
}